package com.lcz.study_designmode.结构型模式.外观模式;

/**
 * <pre>
 * <img width="128" height="110" src="https://tse3-mm.cn.bing.net/th/id/OIP-C.en-w_oH-yn2UsSRfWnOsGAHaGY?w=198&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7" alt="马刺">
 * 作者:     <a href="https://github.com/liuchuanzheng">刘传政</a>
 * 创建时间:  10:51 2022/6/7 0007
 * QQ:      1052374416
 * 电话:     18501231486
 * 描述:      外观类
 * </pre>
 */
public class SmartFacade {
    private Light light;
    private Tv tv;
    private AirCondition airCondition;

    public SmartFacade() {
        light = new Light();
        tv = new Tv();
        airCondition = new AirCondition();
    }

    void say(String message) {
        if (message.contains("打开")) {
            on();
        } else if (message.contains("关闭")) {
            off();
        }
    }

    private void on() {
        light.on();
        tv.on();
        airCondition.on();
    }

    private void off() {
        light.off();
        tv.off();
        airCondition.off();
    }
}
